package com.ysd.lis.controller.bac;

import com.ysd.common.Result;
import com.ysd.lis.annotation.LogDetail;
import com.ysd.lis.aspect.OperationType;
import com.ysd.lis.controller.pub.BaseController;
import com.ysd.lis.entity.bac.BacInterpretationCodeDict;
import com.ysd.lis.entity.sta.StaSensitiveDict;
import com.ysd.lis.request.bac.BacGermBaseDictRequest;
import com.ysd.lis.service.bac.BacInterpretationCodeDictService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 敏感性代码
 *
 * @author LuoXS
 * @date 2024/3/27
 * version 1.0
 */
@RestController
@RequestMapping("/lis/bac/base/interpretation-code/dict")
public class BacInterpretationCodeDictController extends BaseController {


    @Autowired
    BacInterpretationCodeDictService service;


    @ApiOperation("获取微生物基础字典-敏感性代码列表（分页）")
    @GetMapping("/page")
    public Result pageList(BacGermBaseDictRequest.BacInterpretationCodeDictPageParam pageParam) {
        return service.pageList(pageParam);
    }

    @ApiOperation("获取微生物基础字典-敏感性代码列表")
    @GetMapping("/findBacInterpretationCodeDictList")
    public Result findBacInterpretationCodeDictList(BacInterpretationCodeDict bacInterpretationCodeDict) {
        return service.findBacInterpretationCodeDictList(bacInterpretationCodeDict);
    }

    @ApiOperation("新增")
    @PostMapping("/add")
    @LogDetail(requestParam = "add", operationType = OperationType.INSERT, module = "微生物基础字典-敏感性代码", content = "新增敏感性代码", businessName = "bacBase")
    public Result add(@RequestBody BacInterpretationCodeDict dict) {
        return service.add(dict);
    }

    @ApiOperation("修改")
    @PostMapping("/update")
    @LogDetail(requestParam = "update", operationType = OperationType.UPDATE, module = "微生物基础字典-敏感性代码", content = "编辑敏感性代码", businessName = "bacBase")
    public Result update(@RequestBody BacInterpretationCodeDict dict) {
        return service.updateDict(dict);
    }

    @ApiOperation("删除")
    @PostMapping("/delete")
    @LogDetail(requestParam = "delete", operationType = OperationType.DELETE, module = "微生物基础字典-敏感性代码", content = "删除敏感性代码", businessName = "bacBase")
    public Result delete(@RequestBody BacGermBaseDictRequest.BacInterpretationCodeDictDeleteParam deleteParam) {
        return service.delete(deleteParam);
    }

    @ApiOperation("标准库创建")
    @PostMapping("/staDataSyncBacInterCode")
    public Result staDataSyncBacInterCode(@RequestBody List<StaSensitiveDict> staSensitiveDicts) {
        return service.staDataSyncBacInterCode(staSensitiveDicts);
    }


}
